# Solve four simultaneous equations?

**URL:** <https://community.wolfram.com/t/solve-four-simultaneous-equations/23441>\
**Category:** Questions\
**Tags:** algebra, equation-solving, symbolic-computations\
**Created:** [January 15, 2024, 10:11pm UTC](https://community.wolfram.com/t/solve-four-simultaneous-equations/23441 "2024-01-15T22:11:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardyoung9](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@richardyoung9](https://community.wolfram.com/u/richardyoung9)\
**Post date:** [January 15, 2024, 10:11pm UTC](https://community.wolfram.com/t/solve-four-simultaneous-equations/23441/1 "2024-01-15T22:11:29Z")

</div>

I have four equations in four unknowns, a,b,c,d:

```
Sensitivity[a_ ,c_] := (a/(a + c)) * 100

Specificity[b_ , d_] := (d/(b + d)) * 100

PPV[a_ , b_] := (a/(a + b)) * 100

NPV[c_ , d_] := (d/(c + d)) * 100

```

I would like Mathematica to solve for each of a, b, c, d in terms of Sensitivity, Specificity, PPV and NPV.  
I don’t know how to do that. Can anyone help?

---

<div class="post-metadata">

**Author:** ![danl](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/danl/32/41267_2.png) [@danl](https://community.wolfram.com/u/danl)\
**Post date:** [January 15, 2024, 11:41pm UTC](https://community.wolfram.com/t/solve-four-simultaneous-equations/23441/2 "2024-01-15T23:41:13Z")

</div>

sensitivity[a\_, c\_] := (a/(a + c))\*100  
specificity[b\_, d\_] := (d/(b + d))\*100  
pPV[a\_, b\_] := (a/(a + b))\*100  
nPV[c\_, d\_] := (d/(c + d))\*100

```
Solve[{sens == sensitivity[a, c], spec == specificity[b, d],
   ppv == pPV[a, b], npv == nPV[c, d]}, {a, b, c, d}, 
 MaxExtraConditions -> 1]

(*
During evaluation of In[932]:= Solve::svars: Equations may not give solutions for all "solve" variables.

Out[932]= {{b -> 
   ConditionalExpression[(100 a - a ppv)/ppv, 
    100 npv ppv - npv ppv sens - npv ppv spec - 100 sens spec + 
      npv sens spec + ppv sens spec == 0], 
  c -> ConditionalExpression[(100 a - a sens)/sens, 
    100 npv ppv - npv ppv sens - npv ppv spec - 100 sens spec + 
      npv sens spec + ppv sens spec == 0], 
  d -> ConditionalExpression[(
    a npv (-100 + sens))/((-100 + npv) sens), 
    100 npv ppv - npv ppv sens - npv ppv spec - 100 sens spec + 
      npv sens spec + ppv sens spec == 0]}} *)

```

There seems to be a needed compatibility condition to make the system consistent. And also a missing equation because as posed the system is homogeneous in `{a,b,c,d}`, which means a normalization is needed or else we get (as we do) a common parametrized factor (`a`, in this case) in the solutions.
